// 用户相关API
import { request } from "@/http";

export const getAllFiles_API = data => {
  return request("post", "/api/file/findFiles")(data);
};

export const getFilesByFileId_API = data => {
  return request("post", "/api/file/findFileByFileId")(data);
};

export const createFolder_API = data => {
  return request("post", "/api/folder/createFolder")(data);
};

// 创建文件
export const createFile_API = data => {
  return request("post", "/api/file/createFile")(data);
};

// 编辑页面上传图片文件
export const editUploadFile_API = data => {
  return request("post", "/api/file/uploadFile", {
    "Content-Type": "multipart/form-data"
  })(data);
};

export const getShearFile_API = userid => {
  return request("post", "/api/file/shareFile")({ userid });
};

// 加入文件编辑
export const joinFile_API = (userid, fileid) => {
  return request("post", "/api/file/joinFile")({ userid, fileid });
};

// 收藏 置顶文件
export const favorOrTopFile_API = data => {
  return request("post", "/api/file/updateFileState")(data);
};

// 更新文件信息（文件名、文件所属文件夹）
export const updateFile_API = data => {
  return request("post", "/api/file/updateFile")(data);
};

// 保存文件
export const saveFile_API = data => {
  return request("post", "/api/version/updateVersion")(data);
};

// 获取文件内容
export const getFileContent_API = data => {
  return request("post", "/api/file/getFileContent")(data);
};

// 放入回收站
export const putFileOrFolderToRecycle_API = data => {
  return request("post", "/api/file/putFileOrFolderToRecycle")(data);
};

// 文件的导入
export const exportFile_API = data => {
  return request("post", "/api/excel/uploadFile", {
    "Content-Type": "multipart/form-data"
  })(data);
};

// 初始化luckysheet 信息（fileid 获取 title、gridKey、column、row、lang）
export const getExcelInfo_API = data => {
  return request("post", "/api/excel/getWorkBook")(data);
};
